Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel - #32
Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel#32AWqxKAWERbXo with Copilot wants to merge 4 commits into
rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel#32Conversation
Co-authored-by: alxndr-w <3855487+alxndr-w@users.noreply.github.com>
|
@copilot fahre bitte fort mit der Erstellung des PRs. |
Die Implementierung der kopierfähigen URL-Aufrufe ist jetzt abgeschlossen! Die Funktionalität umfasst: ✅ Click-to-Copy für Die Code-Snippets in den Profil-Karten sind jetzt anklickbar und kopieren automatisch den entsprechenden PHP-Code in die Zwischenablage. Commit: f810224 |
rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüsselrex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel
There was a problem hiding this comment.
Pull Request Overview
This PR adds click-to-copy functionality for URL generation code snippets in profile overview cards. Users can now click on rex_getUrl() and rex_article::get()->getUrl() code examples to copy them to their clipboard, improving developer experience when working with URL generation.
- Added interactive code snippets with click-to-copy functionality using modern Clipboard API
- Implemented visual feedback with hover effects and success/error messages
- Enhanced CSS styling for better user interaction and feedback states
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| fragments/url/profiles/card.php | Added click-to-copy functionality with JavaScript and enhanced code elements with CSS classes and data attributes |
| assets/styles.css | Added CSS styles for interactive code elements, hover effects, and feedback tooltips |
| </div> | ||
| </div> | ||
|
|
||
| <script type="text/javascript"> |
There was a problem hiding this comment.
Inline JavaScript should be moved to external files for better separation of concerns and maintainability. Consider creating a separate JS file for the copy functionality.
| function showCopyFeedback(element) { | ||
| var feedback = $('<span class="url-copy-feedback">Kopiert!</span>'); |
There was a problem hiding this comment.
The code duplicates the feedback creation and styling logic between success and error cases. Consider extracting this into a reusable function to reduce duplication.
| function showCopyFeedback(element) { | |
| var feedback = $('<span class="url-copy-feedback">Kopiert!</span>'); | |
| /** | |
| * Shows feedback message near the element. | |
| * @param {jQuery} element - The element to attach feedback to. | |
| * @param {string} message - The feedback message. | |
| * @param {string} [background] - Optional background color. | |
| * @param {number} [duration] - Duration in ms before feedback disappears. | |
| */ | |
| function showCopyFeedback(element, message, background, duration) { | |
| var feedback = $('<span class="url-copy-feedback"></span>').text(message); | |
| if (background) { | |
| feedback.css('background', background); | |
| } |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Alexander Walther <aw@alexplus.de>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Alexander Walther <aw@alexplus.de>
|
@copilot can you create two new issues from the unresolved review feedback in this PR? |
I don't have the necessary GitHub credentials to create issues directly, but I can provide you with the detailed content for two issues based on the unresolved review feedback: Issue 1: "Refactor copy-to-clipboard JavaScript: improve code organization and reduce duplication" Problems to address:
Issue 2: "Clean up copy-to-clipboard code for production readiness" Problems to address:
Both issues reference the specific review comments from PR #32 and include detailed acceptance criteria and suggested implementations. Would you like me to provide the complete issue templates for you to create manually? |
Adds click-to-copy functionality for URL call snippets in profile overview cards, making it easier for developers to copy the exact PHP code needed to generate URLs for their profiles.
Features Added
rex_getUrl()andrex_article::get()->getUrl()code examples are now clickableImplementation
The functionality works by:
url-copy-codeCSS class to code elements withdata-copyattributes containing the exact text to copyUsage
Simply click on any code snippet like:
rex_getUrl('', '', ['warehouse-article-id' => {id}])rex_article::get(123)->getUrl(['warehouse-article-id' => {id}])The complete PHP code will be copied to your clipboard for immediate use in your project.
Fixes #31.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.